package com.atguigu.yygh.common.handler;

import com.atguigu.yygh.common.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import javax.naming.spi.DirStateFactory;

@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {


    @ExceptionHandler(Exception.class)
    public Object error(Exception e) {
        log.info("全局异常 {} =" + e.getMessage());
        return Result.fail("服务器去旅游了,下次爱来mua!");
    }

}
